
var EDIT_JOB_URL = parent.EDIT_JOB_URL;

function select(tmpl) {
	var doc = parent.Doc(parent.document);
	var entityView = doc.selectionSupport.current.entityView;
	var action = new parent.InsertAction(entityView, tmpl);
	parent.focus();
	doc.templatePanel.close();
	action.perform();
}

new parent.EventListener(window, "load", function(evn) {
	var divs = document.getElementsByTagName("div");
	for (var i = 0; i < divs.length; ++i) {
		var d = divs[i];
		if ("label" != d.className)
		  continue;
		d._details = parent.Dom(d).getNextSiblingElement();
    d.onmouseover = mouseover;
    d.onmouseout = mouseout;
	}
	parent.Doc().addEventListener("keydown", function(evn) {
	  if (evn.keyCode == 27) { // ESC
			parent.focus();
			parent.Doc(parent.document).templatePanel.close();
			return parent.EventListener.cancelEvent(evn);
	  }
	});
	this.focus();
});

function mouseover(evn) {
	this._details.style.display = "block";
}

function mouseout(evn) {
  this._details.style.display = "none";
}